<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="p" uri="/WEB-INF/tld/page.tld" %>
<script tye="text/javascript">

	var myTaskId;
	var myNode;

	function distribute(taskId, node) {
		myTaskId = taskId;
		myNode = node;
		loadMember(taskId);
	}
	
	function loadMember(taskId) {
		$("#node-member-div").load("/project/loadNodeMember?projectId=${projectId}"
				+"&taskId="+taskId);
	}

	function selectMember(studentId) {
		var content = $.trim($("#node-member-div").html());
		
		if(content==null||content=='')
			myalert("请选择要给成员分配的任务！！");
		else {
			$.ajax({
				url:"/project/teamDistribute",
				type:"post",
				data:{
					"userTask.task_id":myTaskId,
					"userTask.project_id":"${projectId}",
					"userTask.user_id":studentId,
					"userTask.node":myNode
				},
				dataType:"json"
			}).done(function(data) {
				myalert(data.msg, function() {
					if(data.isSuccess)
						loadMember(myTaskId);
				})
			})
		}
	}
	
	function removeMember(id) {
		myconfirm("确认移除？", function() {
			$.ajax({
				url:"/project/teamMemberRemove/"+id,
				dataType:"json"
			}).done(function(data){
				myalert(data.msg, function(){
					if(data.isSuccess)
						loadMember(myNode);
				});
			})
		})
	}
	
	function turnpage(pageNo) {
		$("#userpage-div").load("/project/teamUser?pageNo="+pageNo);
	}
</script>
<div class="columns">
	<div class="new-row-mobile three-columns three-columns-tablet nine-columns-mobile">
		<div class="block large-margin-bottom">
			<div class="block-title">
				<h3>任务列表</h3>
				<!-- <span class="ribbon"><span class="ribbon-inner">3 new</span></span> -->
			</div>
			<ul class="list spaced">
				<c:forEach items="${nodes }" var="node">
					<li style="padding-left:10px;">
						<a href="javascript:;"><strong>${node.node }&emsp;${node.name }</strong></a>
						<div class="button-group absolute-right compact" style="margin-right: 5px;">
							<a href="javascript:;" class="button icon-pencil"
							 onclick='distribute("${node.id}", "${node.node }");'>分配人员</a>
						</div>
					</li>
				</c:forEach>
			</ul>
		</div>
	</div>
			
	<div class="new-row-mobile six-columns six-columns-tablet twelve-columns-mobile">
		<p class="inline-small-label button-height">
			<!-- <label style="float:left;margin-left:-50px;">用户名</label>
			<input style="float:left;width:50px;" type="text" id="username" class="input"> -->
			<!-- <label style="float:left;margin-left:20px;">用户名</label>
			<input style="float:left;width:50px;" type="text" id="username" class="input"> -->
		</p>
		<p><!-- <button class="button blue-gradient glossy" onclick="queryUser();">查询</button> --></p>
		<div id="userpage-div">
		<jsp:include page="team_user.jsp"/></div>
	</div>
	
	<div class="new-row-mobile three-columns three-columns-tablet nine-columns-mobile" id="node-member-div">
		
	</div>
</div>
    